home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / prbgi00c.zip / PRINTBGI.DOC < prev    next >
Text File  |  1992-03-20  |  49KB  |  1,282 lines

  1.  
  2. Documentation of PRINTBGI package copyright (C) Andrzej Resztak 1991,
  3. all rights reserved.
  4.  
  5.  
  6. Introduction
  7.  
  8.    This is a prerelease version 0.91 of my PrintBGI toolkit. It was
  9. developed to help programmers using Borland languages (Borland/Turbo C(++)
  10. or Turbo Pascal) and BGI drivers to print graphics on the printer
  11. (and in the future on the other devices) as easy as you can draw it
  12. on the screen. In fact even more, the same function can produce
  13. it's output on a screen or on a printer according to conditions
  14. at which it was called.
  15.    It's really easy to learn. Developing your own applications does
  16. not require writing two similar procedures (one for screen drawing
  17. and the other for printer or plotter).
  18. Maintenance of the code is simple, since all extensions or bug fixes
  19. must be made in one place only. I hope you will enjoy this package.
  20.  
  21.    For registration, license and payment see REGISTER.DOC.
  22.  
  23. This file contains all technical news you must understand to use
  24. this package easy and effectively.
  25.  
  26.  
  27.             SOME OVERVIEW
  28.             ==============
  29.  
  30.    This package can be divided into two independent parts. First is
  31. BGI driver called by me BItImage BGI driver. This driver can be used
  32. to create bit maps of any size of any picture. (By bit map I mean
  33. two dimensional array of 1,2,4 or 8 bits elements). Note however that
  34. the BGI driver does only some low level work (hardware specific) and
  35. in most cases it depends on high level routines contained in Borland
  36. graphics library kernel. Since there are some differences between printer
  37. and screen oriented devices the initialization of my BitImage BGI
  38. driver is somewhat different of initialization of standard Borland
  39. video BGI drivers. For example it cannot perform any auto detection,
  40. specifying printer being used does not determine the size of the graphic
  41. output and there is some minor differences. Because of these differences
  42. you must call some PRT_Setxxxxxxx functions of the package to specify
  43. parameters at which you want the BitImage driver to work. And initialization
  44. of the driver should be done using PRT_initgraph function not standard
  45. initgraph routine.
  46.    The second part of the package make routines contained in PRTGRAPH library
  47. which hide some of the differences between my BitImage driver and
  48. standard Borland video drivers. They also will make it very easy to print
  49. something on your output device (currently only the dot matrix printers).
  50.  
  51.  
  52.    Now I describe you the easiest way you can add graphic output
  53. to your programs using this PRINTBGI toolkit. Other sections
  54. will let you know some more features, but this section is very good
  55. for beginning, I hope.
  56.  
  57.    First, I highly recommend you to include prototypes of all functions
  58. defined in PRINTBGI package by just inserting
  59. #include <PRTGRAPH.H>
  60. statement at  the  beginning  of  your  module.  Although  it  is  not 
  61. necessary
  62. I also recommend you to place PRTGRAPH module after any standard modules you
  63. use. It'll enable me some tricky modifications in the future versions
  64. of this package.
  65.    You must also remember about linking in PRTGRAPH.LIB either
  66. listing it in PRJ file in integrated environment or adding at the
  67. command line invoking stand alone version of the compiler (or linker).
  68.  
  69.  
  70.  
  71.    Next I assume that you like modular structure programming and have
  72.    routine called (say) DrawFunc which meets following conditions.
  73.       - It draws on the screen picture you want to print it out.
  74.       - It does not use any nonstandard procedures (that is not
  75.         defined in GRAPH.TPU or GRAPHICS.LIB) to manipulate screen
  76.         output.
  77.       - It does not use initgraph,restorecrtmode,closegraph or setgraphmode
  78.         function. It simply assumes that appropriate graphic mode was
  79.         established before calling it.
  80.       - It is written in BGI independent way. That is it uses getmaxx,
  81.         getmaxy, getmaxcolor, getaspectratio to get device dependent
  82.         characteristic and scales all output according to it.
  83.       - If you are using my recommended way to print your picture out, that
  84.         is you are using PRT_PrintBGI function than it may happen that this
  85.         function will call your drawing routine few or several times to print
  86.         out the whole picture. This may happen when there is not enough free
  87.         memory to build the whole bit image map of the picture at once. In
  88.         that case the bit map will be created piece by piece (each time
  89.         calling your drawing routine).
  90.         So, although it is not necessary it is recommended that your routine
  91.         will draw the same picture (pixel in pixel) each time it will be
  92.         called by PRT_PrintBGI function. Of course in the next invoke
  93.         of the PRT_PrintBGI routine your DrawFunc may draw something
  94.         completely different.
  95.  
  96.       ( If it is not your case (you don't have such a function)  you may
  97.         either rewrite your code to have such a function or use some lower
  98.         level functions included in this package. I once again highly
  99.         recommend to choose the first method. )
  100.  
  101.       If you have such a function you must inform the package what kind
  102.    of printer you have and at what resolution you want it to operate.
  103.    To do that just call PRT_SetDriver function with appropriate parameters
  104.    PrinterNo and ModeNo (use constants defined in PRTGRAPH.H or in 
  105. PRTGRAPH.PAS)
  106.    as well as picture size and options.
  107.    For example the following statements may print out picture drawn by
  108.    DrawFunc on the IBM ProPrinter.
  109.  
  110.    {
  111.       int   PRTdrv,PRTmode,ReturnCode;
  112.       PRT_SetDriver ( IBM9, IBM9_120x72, 4000,3000, PRT_INVERSE );
  113.       PRTdrv = DETECT;
  114.       PRTmode=0;
  115.       /* If you want you may linked in the BitImage BGI driver into the */
  116.       /* EXE file. To do so uncomment  following two lines. */
  117.       /* PRTdrv = PRT_installuserdriver ( "BitImage", NULL );  */
  118.       /* PRT_registerfarbgidriver ( &BitImage );               */
  119.       ReturnCode = PRT_PrintBGI ( &PRTdrv,&PRTmode,"d:\\bc\\bgi", DrawFunc );
  120.    }
  121.  
  122.    In the best case it's all you have to do. Isn't it easy? I'm sure you
  123. must admit it is.
  124.  
  125.    Of course in most situations it is not enough. Above statements
  126. will cause all output to be sent to the standard PRN device.
  127. If you would like (or have to cause you don't have printer at
  128. LPT1 for example) to change these parameters you
  129. should call some more functions of the PRINTBGI package as well
  130. as you should code some lines to let user of your program specify
  131. his own requirements. But all of this can be done!
  132.    You may also wish to print in inverse, reverse, with any density
  133. at any size. The only disadvantage of using this package is that it
  134. is perceptible slower than usual Print Screen procedure.
  135.  
  136.  
  137.  
  138. ========================================================================
  139.          FUNCTIONS DETAILS
  140. ========================================================================
  141.  
  142.    Following section will describe in details all functions which
  143. can be found in PRINTBGI package. This package as distributed in
  144. shareware version was developed and tested in LARGE memory model
  145. (I suppose this the mode most graphic programs use) using BC++ v2.0.
  146. To use it in other memory model you may need full sources of it
  147. (available from the author - see REGISTER.DOC).
  148.  
  149.    When it is mentioned that the function returns zero on success and
  150. nonzero on failure it means that one of the following codes may be
  151. returned
  152.    0                       -  success.
  153.    PRT_NO_MEMORY           1
  154.    PRT_WRONG_PARAMETERS    2
  155.    PRT_NOT_INITIALIZED     3
  156.    PRT_IO_ERROR            4
  157.    PRT_ERROR               5
  158.  Occasionally you can get other code returned from standard Borland graphic
  159. functions or write procedure. You may also get returned code from your own
  160. DrawFunc routine if it returns nonzero code.
  161.  
  162.  
  163. All functions can be divided into following categories.
  164.    - Functions used to set various work parameters.
  165.       PRT_Buffer
  166.       PRT_EMSBuffer
  167.       PRT_RescaleFillPattern
  168.       PRT_SetBuffer
  169.       PRT_SetOutName
  170.       PRT_SetMargins
  171.       PRT_SetDriver
  172.       PRT_SetViewSize
  173.       PRT_SetErrorFunc
  174.       PRT_SetOpenFunc
  175.       PRT_SetCloseFunc
  176.       PRT_SetWriteFunc
  177.       getfillpattern16
  178.       setfillpattern16
  179.    - Functions used to print out the picture
  180.       PRT_PrintBGI
  181.       and some functions used internally by PRT_PrintBGI
  182.       (use them only if necessary, the preferable method is using
  183.       PRT_PrintBGI which will virtually do all necessary work for you).
  184.          PRT_AllocateBuffer
  185.          PRT_BuildBitMap
  186.          PRT_BufferNeeded
  187.          PRT_closegraph
  188.          PRT_EndPrt
  189.          PRT_FreeBuffer
  190.          PRT_getpixel
  191.          PRT_initgraph
  192.          PRT_InitPrt
  193.          PRT_installuserdriver
  194.          PRT_PrintBuffer
  195.          PRT_registerfarbgidriver
  196.          PRT_Unregisterfarbgidriver
  197.    - Functions used to get various informations about package and current
  198.      settings of miscellaneous parameters.
  199.       PRT_DriverName
  200.       PRT_DriverNo
  201.       PRT_errormsg
  202.       PRT_MaxDriver
  203.       PRT_MaxMode
  204.       PRT_ModeName
  205.       PRT_ModeNo
  206.       PRT_Resolution
  207.  
  208.  
  209. Global export variable
  210.    PRT_HaltPrinting
  211.  
  212.  
  213.    Here are all functions listed alphabetically. Specification will begin with
  214. function declaration followed by exact description of all parameters.
  215.  
  216.  
  217.    getfillpattern16
  218.    =================
  219.  
  220. void getfillpattern16 ( char FAR * upattern );
  221.  
  222.    You may use this function to copy 16x16 bit fill pattern set by
  223. setfillpattern16 function into the 32 (!) byte area pointed to by upattern.
  224. This function may be used only when BITIMAGE BGI driver is active, for all
  225. other BGI drivers it will be ignored.
  226.    See also PRT_RescaleFillPattern.
  227.  
  228.  
  229.  
  230.    PRT_AllocateBuffer
  231.    ===================
  232.  
  233. int PRT_AllocateBuffer ( void );
  234.  
  235.    This function allocates buffer for picture bit image map. It
  236. allocates as much memory as allowed by PRT_SetBuffer but not more than
  237. needed.
  238.    Note that attempt to allocate buffer is performed in the
  239. following order. First it is tried to allocate EMS buffer next
  240. conventional one ( XMS buffer is not implemented yet). It may result
  241. in allocating buffer smaller than available memory (e.g if there is
  242. 200k of free conventional memory and 32k of free EMS memory then 32k
  243. EMS buffer will be allocated). Note also that buffer always fits in
  244. one kind of memory. There is no possibility to create buffer say 200K
  245. large containing of 60K of conventional memory and rest of EMS or XMS
  246. memory.
  247. Used internally by PRT_PrintBGI may also be called by user needing
  248. some nonstandard possibilities.
  249.    Returns 0 on success, nonzero on failure.
  250.  
  251.    see also PRT_SetBuffer, PRT_BufferNeeded.
  252.  
  253.  
  254.    PRT_BuildBitMap
  255.    ================
  256.  
  257. int FAR_PROC pascal  PRT_BuildBitMap (
  258.                               int far * graphdriver, int far *graphmode,
  259.                               char far *pathtodriver,
  260.                               int x1,int y1, int x2,int y2,
  261.                               int ( FAR_PTR * FAR_PROC  Draw)(void));
  262.  
  263. Parameters
  264.    graphdriver,graphmode,pathtodriver - see PRT_initgraph.
  265.    x1,y1,x2,y2 - coordinates of the rectangular piece of the whole
  266.                  picture currently being build by the BitImage BGI driver.
  267.                  All requests to read or write outside the specified region
  268.                  will be ignored. Functions reading pixel value from outside
  269.                  outside of the specified region will always return zero
  270.                  result (without error set).
  271.    DrawFunc    - see PRT_PrintBGI.
  272.  
  273.    Initializes BITIMAGE BGI driver by calling PRT_initgraph. Calls
  274. DrawFunc and DOES NOT close down BITIMAGE BGI driver (and does not free
  275. the buffer with created bit image map). This should result in build
  276. (x1,y1,x2,y2) rectangle of bit image map cut from the entire picture.
  277.  
  278.    This function assumes that PRT buffer large enough to contain
  279. (x1,y1),(x2,y2) rectangle was already allocated using PRT_AllocateBuffer
  280. function.
  281.  
  282.    Returns 0 on success, nonzero on failure.
  283.  
  284.  
  285.    PRT_Buffer
  286.    =============
  287.  
  288. int FAR_PROC pascal PRT_Buffer ( void far *address, long size, int usable )
  289.    Defines conventional memory buffer for use by the PrintBGI package.
  290.    Parameters:
  291.       usable   :  0 (zero) means not to use conventional memory. Other
  292.                   arguments are in that case ignored (but preferably should
  293.                   also be zero).
  294.       address  :  Address of conventional memory buffer to use or NULL (buffer
  295.                   will be allocated later by other functions of this package).
  296.       size     :  If address is not NULL defines size (in bytes)
  297.                   of the caller allocated buffer.
  298.                   If address is NULL than
  299.                     -   positive value defines maximum number of memory
  300.                         which can be used for the buffer by PrintBGI package.
  301.                     -   negative value defines minimum number of memory left
  302.                         free after buffer allocation.
  303.                     -   zero allows to allocate as much memory as needed for
  304.                         the buffer leaving only absolutely minimum free.
  305.  
  306.    See also PRT_EMSBuffer.
  307.  
  308.    PRT_BufferNeeded
  309.    =================
  310.  
  311. long PRT_BufferNeeded ( int x1, int y1, int x2, int y2 );
  312.  
  313.    Returns size of buffer needed to draw picture of specified size on
  314. specified printer. If there exist less free memory than needed than
  315. picture would be drawn in pieces. In that case results of all
  316. procedures reading pixel values may be inaccurate.
  317.    May be called only after PRT_SetDriver.
  318.  
  319.  
  320.    PRT_closegraph
  321.    ===============
  322.  
  323. int PRT_closegraph(void);  /* DOES NOT free the buffer   */
  324.  
  325.    Closes down the BGI driver which was being used to print the picture out.
  326. In the case of BitImage BGI driver being used this function DOES NOT free
  327. the buffer with created bit image map of the picture. Just you may close
  328. down the BitImage BGI driver and still have buffer with created bit image
  329. map of the picture. It enables you to activate any other BGI driver and
  330. display created pixel map. But remember to free the buffer calling
  331. PRT_FreeBuffer function.
  332.  
  333.    Returns 0 on success, nonzero on failure.
  334.  
  335.  
  336.    PRT_DriverName
  337.    ===============
  338.  
  339. int PRT_DriverName ( unsigned driverno, char FAR * FAR* name_ptr  );
  340.  
  341.    Assigns to StringPtr pointer pointing to static string containing the name
  342. of driver numbered driverno. The driver name is general name of all printers
  343. supported by the driver or the name of the most common printer from
  344. all supported by it.  It can be used to list user all allowable printers and
  345. let him choose the appropriate one.
  346.    Returns 0 on success, nonzero on failure.
  347.  
  348.  
  349.    PRT_DriverNo
  350.    =============
  351.  
  352. int PRT_DriverNo ( void );
  353.    Returns current driver number as set by PRT_SetDriver or minus one.
  354.  
  355.  
  356.    PRT_EMSBuffer
  357.    =============
  358.  
  359. int FAR_PROC pascal PRT_EMSBuffer ( int handle, long size, int usable )
  360.    Defines EMS buffer for use by the PrintBGI package.
  361.    Parameters:
  362.       usable   :  0 (zero) means not to use EMS memory. Other arguments are
  363.                   in that case ignored (but preferably should also be zero).
  364.       handle   :  Number of EMM handle to use for the buffer or zero (buffer
  365.                   will be allocated by the package)
  366.       size     :  If handle is nonzero defines amount of memory (in bytes)
  367.                   allocated to that handler by the caller.
  368.                   If handle is zero then
  369.                     -   positive value defines maximum number of memory (will 
  370. be
  371.                         rounded down to 16 KB boundary) which can be used for
  372.                         the buffer by PrintBGI package.
  373.                     -   negative value defines minimum number of memory left
  374.                         free after buffer allocation.
  375.                     -   zero allows to allocate as much memory as needed for
  376.                         the buffer leaving only absolutely minimum free.
  377.  
  378.    See also PRT_Buffer.
  379.  
  380.    PRT_EndPrt
  381.    ==========
  382.  
  383. int FAR_PROC _PRT__pascal PRT_EndPrt ( int handle );
  384.  
  385.    Sends printer initialization sequence to the specified handle.
  386. To print it out uses PRT_write function set by PRT_SetWriteFunc routine.
  387.    Note also that my standard PRT_Write function will call PRT_WriteError
  388. function (set by PRT_SetErrorFunc) whenever output error occurs.
  389.    Returns 0 on success, nonzero on failure.
  390. See also PRT_SetOpenFunc, PRT_SetCloseFunc, PRT_SetWriteFunc,
  391. PRT_SetErrorFunc.
  392.  
  393.  
  394.    PRT_errormsg
  395.    ============
  396.  
  397. char far * FAR_PROC PRT_errormsg ( int errorcode );
  398.    Returns pointer to error message associated with errorcode.
  399.  
  400.  
  401.    PRT_FreeBuffer
  402.    ==============
  403.  
  404. int PRT_FreeBuffer (void);
  405.  
  406.    Internal procedure freeing the buffer allocated by PRT_AllocateBuffer.
  407. In the case of freeing EMS buffer does not restore EMS mapping to the state
  408. from before PRT_AllocateBuffer.
  409.    Returns 0 on success, nonzero on failure.
  410.  
  411.  
  412.  
  413.    PRT_getpixel
  414.    =============
  415.  
  416. int  PRT_getpixel ( int x, int y );
  417.  
  418.    Performs the same function as standard Borland getpixel function but with
  419. two differences.
  420.    Parameters x and y are not whole picture relative
  421. but buffer relative. It makes no difference if there is enough memory
  422. for the whole picture. But if there is not enough free memory 
  423. PRT_getpixel(0,0) will return value of first pixel in the buffer
  424. not the first pixel on the virtual screen. What this pixel is at the whole
  425. picture depends on parameters x1 and y1 passed to PRT_SetViewSize.
  426.    The second difference is that if you load ( or link in) the driver manually
  427. you will be able to call this function after closing BITIMAGE BGI driver
  428. (after PRT_closegraph and maybe also after activating another BGI driver)
  429. but, of course before releasing the screen buffer, and unregistering the
  430. driver (see PRT_Unregisterfarbgidriver). If the driver is loaded
  431. automatically (e.g. by PRT_initgraph) it will be deleted by PRT_closegraph
  432. and you MUST NOT use this function in that case when BGI driver is not
  433. active.
  434.  
  435.  
  436.  
  437.    PRT_initgraph
  438.    ==============
  439.  
  440. int FAR_PROC pascal PRT_initgraph( int far * graphdriver, int far *graphmode,
  441.                                    char far *pathtodriver );
  442.  
  443. Parameters
  444.    graphdriver : points to an integer that specifies graphic driver to be 
  445. used.
  446.                  Note that earlier you should install BGI driver
  447.                  (currently BitImage driver  only is included into the
  448.                  package) using PRT_installuserdriver function.
  449.                  If you specify DETECT as a passing argument value
  450.                  then the driver last used in PRT_initgraph or last installed
  451.                  using PRT_installuserdriver will be used. If none BGI printer
  452.                  driver was installed so far than PRT_installuserdriver will 
  453. be
  454.                  called to install appropriate driver for printer defined
  455.                  by PRT_SetDriver. No true auto detection is (or will be)
  456.                  available.
  457.    graphmode   : points to an integer that specifies graphic mode to be used.
  458.                  It should point to zero value since in current version you
  459.                  must specify desired printing mode using PRT_SetDriver
  460.                  function.
  461.    pathtodriver : Specifies path to BGI drivers and CHR fonts. This parameter
  462.                  will be passed further to PRT_initgraph.
  463.  
  464.  
  465.    Initializes BITIMAGE BGI driver for creating bit image map.
  466. Note that YOU MUST earlier specify rectangle area for which bit map will
  467. be created by calling PRT_SetViewSize function.
  468. All requests for drawing (or reading) pixels outside that
  469. area will be ignored without any error codes. This would enable
  470. building the screen from rectangle pieces and printing it out even if
  471. there is not enough free memory to build the whole bit image map of
  472. printed picture at once.
  473.  
  474.    You must call PRT_SetViewSize before PRT_initgraph.
  475. (x1,y1),(x2,y2) area (specified by PRT_SetViewSize) must fill
  476. entire within  - PREVIOUSLY - allocated buffer (via PRT_AllocateBuffer),
  477. otherwise an error code is return.
  478.    Returns 0 on success, nonzero on failure.
  479.  
  480.  
  481.    PRT_InitPrt
  482.    ============
  483.  
  484. int FAR_PROC _PRT__pascal PRT_InitPrt ( int handle );
  485.  
  486.    Sends printer ending sequence to the specified handle.
  487. To print it out uses PRT_write function set by PRT_SetWriteFunc routine.
  488.    Note also that my standard PRT_Write function will call PRT_WriteError
  489. function (set by PRT_SetErrorFunc) whenever output error occurs.
  490.    Returns 0 on success, nonzero on failure.
  491. See also PRT_SetOpenFunc, PRT_SetCloseFunc, PRT_SetWriteFunc,
  492. PRT_SetErrorFunc.
  493.  
  494.  
  495.    PRT_installuserdriver
  496.    =====================
  497.  
  498. int FAR_PROC pascal PRT_installuserdriver ( const char far * name,
  499.                                             int huge (*detect)(void) );
  500.  
  501.    Used instead of standard Turbo installuserdriver function.
  502.  
  503.  
  504.    PRT_MaxDriver
  505.    ==============
  506.  
  507. unsigned PRT_MaxDriver ( void );
  508.  
  509.    Returns maximum allowed printer driver number in PRINTBGI package;
  510.    See also PRT_SetDriver, PRT_DriverName, PRT_DriverNo.
  511.  
  512.  
  513.  
  514.    PRT_MaxMode
  515.    ============
  516.  
  517. int PRT_MaxMode ( unsigned driverno, int FAR *maxmode );
  518.  
  519.    Assigns to maxmode maximum mode number allowed for given driverno.
  520.    Returns 0 on success, nonzero on failure.
  521.    See also PRT_ModeName,  PRT_ModeNo.
  522.  
  523.  
  524.    PRT_ModeName
  525.    =============
  526.  
  527. int PRT_ModeName ( unsigned driverno, int modeno,
  528.                      char FAR* FAR* name_ptr );
  529.  
  530.    Assigns to StringPtr pointer pointing to static string containing name
  531. of mode modeno of printer numbered driverno. It can be used to list user
  532. all allowable modes and let him choose one.
  533.    Returns 0 on success, nonzero on failure.
  534.  
  535.  
  536.    PRT_ModeNo
  537.    ==========
  538.  
  539. int PRT_ModeNo ( void );
  540.  
  541.    Returns current mode number as set by PRT_SetDriver or negative
  542. value.
  543.  
  544.  
  545.  
  546.    PRT_PrintBGI
  547.    =============
  548.  
  549. int FAR_PROC pascal
  550.       PRT_PrintBGI ( int far * graphdriver, int far *graphmode,
  551.                      char far *pathtodriver,
  552.                      int ( FAR_PTR * FAR_PROC  /* pascal */ Draw)(void) );
  553.  
  554. Parameters
  555.    graphdriver,graphmode,pathtodriver - see PRT_initgraph.
  556.    Draw        : function drawing picture you want to print.
  557.  
  558.    This is the main function of the whole package. In fact it does most
  559. of the work and using it is the most recommended way of using the whole
  560. PRINTBGI package. Of course in some nonstandard situations you may
  561. want to use some lower level routines to get more control over the package.
  562. But I think it will be very rarely case.
  563.  
  564.    I'll list all functions it does in the order they are performed.
  565. It should let you better understand other functions of this
  566. package.
  567.  
  568.    So it does the following.
  569.    1. Checks the correctness of arguments used in call to
  570.       PRT_SetDriver. Returns immediately PRT_NOT_INITIALIZED value if
  571.       they are incorrect, otherwise goes to step 2.
  572.    2. Checks if any BGI driver was active when it was called. If it
  573.       was closes it down and saves information needed to restore
  574.       screen graphic mode. Note that this step (or step 7
  575.       restoring caller graphic mode) may not work  correctly at all
  576.       circumstances (since for example it is very hardly to guess
  577.       what BGI driver was active at call to PRINTBGI).
  578.       So I highly recommend you to close down any BGI drivers you
  579.       were using before calling this function. Note also that
  580.       rectorecrtmode functions DOES NOT close down BGI driver but
  581.       only deactivates it. So you MUST USE closegraph function rather
  582.       than rectorecrtmode one before calling PRT_PrintBGI.
  583.    3. Allocates buffer using PRT_AllocateBuffer function.
  584.       If buffer allocation is unsuccessful returns immediately, otherwise
  585.       computes window size filling entirely in the allocated buffer.
  586.       This window may (or may not) cover the whole printing picture.
  587.    4. Calls PRT_Open,PRT_InitPrt to open file handle and to send
  588.       initialization codes to the printer.
  589.    5. Calls PRT_BuildBitMap to create bit image map of current
  590.       rectangle piece of picture went into allocated buffer. PRT_BuildBitMap
  591.       is described earlier in this chapter.
  592.    6. Calls PRT_PrintBuffer to print out current buffer ( which now
  593.       contains one belt (line) of picture). If it is not the last
  594.       (or the only one) piece to print returns to point 5.
  595.    7. Calls PRT_EndPrt,PRT_Close;
  596.    8. Calls PRT_closegraph to close down the BGI driver used to create
  597.       bit image map of the printed picture.
  598.    9. Frees allocated buffer by calling PRT_FreeBuffer.
  599.   10. If in step 2 the active BGI driver was closed down tries now to
  600.       reactivate it. Note that it uses standard detectgraph function to
  601.       determine which BGI driver reactivate. So if you had nonstandard
  602.       BGI drivers active (e.g. SVGA or VGA256) it may happen that standard
  603.       VGA driver will be reactivate instead of the actually active one.
  604.       To avoid this problem either close down video BGI driver (using
  605.       closegraph) before calling PRT_PrintBGI or install nonstandard
  606.       BGI drivers with appropriate auto detection function
  607.       (see installuserdriver function in Borland documentation).
  608.   11. Returns to the caller.
  609.  
  610.  
  611.    Procedure DrawFunc passed as an argument should meet the following
  612.    conditions.
  613.       - It draws on the screen the picture you want to print it out.
  614.       - It does not use any nonstandard graphic procedures (that is not
  615.         defined in GRAPH.TPU or GRAPHICS.LIB) to manipulate screen
  616.         output.
  617.       - It does not use initgraph, restorecrtmode, closegraph or setgraphmode
  618.         procedure. It simply assumes that appropriate graphic mode was
  619.         established before calling it.
  620.       - It is written in BGI independent way. That is it uses getmaxx,
  621.         getmaxy, getmaxcolor, getaspectratio to get device dependent
  622.         characteristic and scales all output according to it.
  623.       - Although it is not necessary it is recommended that it draws
  624.         the same picture (if the same BGI driver is used) each time
  625.         it is called.
  626.         This may be because if there is not enough memory to build bit image
  627.         map of the entire picture at once it is necessary to call
  628.         DrawFunc routine few times to create the picture piece by
  629.         piece (line by line). If it would draw different output at
  630.         consecutive calls then printed lines would not suit each other.
  631.       - It returns zero on success and nonzero on fail. This nonzero code
  632.         will cause immediate finish of the PRT_PrintBGI function and will
  633.         be also returned by it to the caller.
  634.  
  635.  
  636.    Note also that if there is not enough free memory to build the whole
  637. bit image map needed at once than some graphic functions which read the
  638. screen explicitly (e.g. getpixel,getimage) or implicitly (e.g. floodfill) may
  639. produce inaccurate results. This may happen if they refer to currently
  640. not building part of the picture.
  641.    Setting PRT_HaltPrinting variable to nonzero value lets you break
  642. this function before it will finish.
  643.  
  644.  
  645.    PRT_PrintBuffer
  646.    ================
  647.  
  648. int  PRT_PrintBuffer (int handle);
  649.  
  650.    Prints entire "screen" buffer to the specified handle
  651. adding necessary control codes (see PRT_SetDriver).
  652.    To print out the buffer it uses PRT_write function set by
  653. PRT_SetWriteFunc routine.
  654.    Note also that my standard PRT_Write function will call PRT_WriteError
  655. function (set by PRT_SetErrorFunc) whenever output error occurs.
  656.  
  657.    Returns 0 on success, nonzero on failure.
  658.  
  659. See also PRT_SetOpenFunc, PRT_SetCloseFunc, PRT_SetWriteFunc,
  660. PRT_SetErrorFunc.
  661.  
  662.  
  663.    PRT_registerfarbgidriver
  664.    ========================
  665.  
  666. int FAR_PROC pascal PRT_registerfarbgidriver ( void far pascal (*driver)(void) 
  667. );
  668.    Use it instead of standard  registerbgidriver or registerfarbgidriver
  669. function. But note that before deleting registered driver from memory you
  670. MUST use PRT_Unregisterfarbgidriver function.
  671.  
  672.  
  673.    PRT_RescaleFillPattern
  674.    =======================
  675.  
  676. int PRT_RescaleFillPattern ( int r );
  677.  
  678.    Since external graphic devices have in most cases grater maximum
  679. possible resolution than screens, standard 8x8 fill patterns seem to be
  680. too small to use. This procedure let you demand of rescaling standard
  681. 8x8 fill patterns to 16x16 ones.
  682.    Parameter r means
  683.          0 = never rescale to 16x16,
  684.          1 = always rescale to 16x16,
  685.          -1 = rescale to 16x16 at high densities only.
  686.    The default value is -1.
  687.    Returns 0 on success, nonzero on failure.
  688.    If used must be called before initializing BITIMAGE BGI driver.
  689.  
  690.    See also setfillpattern16.
  691.  
  692.  
  693.    PRT_Resolution
  694.    ===============
  695.  
  696. int  PRT_Resolution ( int FAR *Xres, int FAR *Yres );
  697.  
  698.    Assigns to Xres and Yres dpi (dots per inch) resolution in
  699. appropriate direction according to last call of PRT_SetDriver.
  700.    Returns 0 on success, nonzero on failure.
  701.  
  702.  
  703.  
  704.    PRT_SetBuffer
  705.    ==============
  706.  
  707. int PRT_SetBuffer ( long size, unsigned BufOpt );
  708.  
  709.    Parameters
  710.       BufOpt : specifies what kind of memory may be used for buffer.
  711.                Allowed values.
  712.                   NotUseEMS (1) - use XMS or conventional memory
  713.                   NotUseXMS (2) - use EMS or conventional memory.
  714.                   NotUseEMS+NotUseXMS - use conventional memory only.
  715.                   0             - use any memory.
  716.       size   : if positive specifies maximum amount of memory that 
  717.                can be used for the buffer.
  718.                If negative specifies how minimum amount of memory that
  719.                must be left free after buffer allocation.
  720.                This parameter is currently meaningful only if conventional
  721.                memory is used.
  722.    Returns
  723.       0 on success, nonzero on failure.
  724.  
  725.  
  726. XMS memory is not supported in current release.
  727.  
  728.    PRINTBGI package uses the so called screen buffer to build bit
  729. image map of printing output in it. This procedure specifies what kind
  730. of memory can be used for that buffer. The whole buffer is allocated
  731. in one kind of memory in the following priority order EMS, XMS,
  732. conventional memory.
  733.  
  734.    If you have no particular need you should not call this procedure.
  735. If not called PRINTBGI will behave as you call it with both parameters
  736. zeroed thus enabling allocation of the buffer of the best size.
  737.  
  738.    If you let PRINTBGI use EMS memory keep in mind that DrawFunc ( set
  739. as parameter to PRT_PrintBGI) or any procedure called by it may not use
  740. EMS memory. Of course unless you save and current EMS mapping at start
  741. and restore it at the end of your DrawFunc routine
  742. which will make your use of EMS completely invisible by PRINTBGI.
  743. Note also that PRINTBGI does not save and restore EMS mapping at
  744. any time. So if you want you can save EMS mapping before call of any
  745. function that uses it and restore it afterwards. Following functions
  746. may change EMS mapping: PRT_PrintBuffer, PRT_PrintBGI, PRT_BuildBitMap,
  747. PRT_getpixel as well as any graphic routines using BitImage BGI driver.
  748.    If used, must be called before initializing BITIMAGE BGI driver.
  749.  
  750. Try to use PRT_Buffer and PRT_EMSBuffer instead.
  751.  
  752.  
  753.    PRT_SetCloseFunc
  754.    =====================
  755.  
  756.    typedef int ( FAR_PROC * PRT_CloseFuncP)( int handle );
  757. PRT_CloseFuncP PRT_SetCloseFunc ( int far f(int handle) );
  758.  
  759.    Defines function (passed as an argument f) which will be called to close
  760. file handle used to print out the picture. The f function takes an integer
  761. argument which is supposed to contain an opened file handle. Exactly this is
  762. the case if you do not specified your own open function in which case it
  763. contains a number returned from your open function (see PRT_SetOpenFunc).
  764. This f function should return zero on success close handle and suitable
  765. nonzero code otherwise.
  766.    If NULL is passed as an argument f then the old close function used so far
  767. will not be changed.
  768.    PRT_SetCloseFunc returns pointer to previously used close function.
  769.  
  770.    See also PRT_SetOpenFunc, PRT_SetCloseFunc, PRT_SetErrorFunc.
  771.  
  772.  
  773.    PRT_SetDriver
  774.    ==============
  775.  
  776. int PRT_SetDriver ( unsigned drv, unsigned mode,
  777.                      unsigned width, unsigned height, unsigned options );
  778.  
  779.  
  780.    Parameters
  781.       drv   : defines driver (and thus printer) number which will be
  782.               used. Allowed values (See PRINTBGI.H or PRINTBGI.PAS) are:
  783.               IBM9, EPSON9, PANASONIC9, EPSON24, IBM24, HPLJII, IBM9c,
  784.               EPSON9c, EPSON24c, IBM24c.
  785.       mode  : defines driver (printer) mode number which will be
  786.               used. Allowed values are defined in PRINTBGI.H (or 
  787. PRINTBGI.PAS).
  788.       width,height   : defines width and height of the next printing
  789.                        picture in 1/1000 inch values. That is 4000
  790.                        means 4 inches.
  791.       options        : can be defined as zero or it may have set one of the
  792.                        following bits
  793.          PRT_ROTATE  : if not set picture will be printed horizontally
  794.                        if set picture will be printed vertically.
  795.          PRT_INVERSE : if not set pixel of value 0 will be printed
  796.                        as black and pixel of value 1 will be printed white.
  797.                        1 means otherwise.
  798.                        For color printers 1 will force bit negation
  799.                        of pixel value before printing.
  800.    Returns
  801.       0 on success, nonzero on failure.
  802.    Default values.
  803.       Must be called. No default values assumed.
  804.  
  805.    Values defined by PRT_SetDriver stay in effect until next call of
  806. that procedure changing them explicitly.
  807.    Must be called before initializing BITIMAGE BGI driver.
  808.    No checking is (or will be) made if specified values are correct for your
  809. hardware. It is responsibility of the caller to detect hardware (or rather ask
  810. user to define it) and specify picture size acceptable by it.
  811.  
  812.  
  813.    PRT_SetErrorFunc
  814.    =====================
  815.  
  816.    typedef int ( FAR_PROC * PRT_ErrorFuncP) ( int handle );
  817. PRT_ErrorFuncP PRT_SetErrorFunc ( int WrErrFunc(int handle) );
  818.  
  819.    Defines function (passed as an argument ErrFunc) which will be
  820. called whenever I/O error occur during printing. ErrFunc must
  821. return zero to retry printing or nonzero error code to abort
  822. printing. In that case the function in which an error occurred
  823. returns immediately to the caller with the same return code as received
  824. from ErrorFunc.
  825.    If ErrFunc argument passed is NULL no ErrFunc will be called
  826. whenever I/O error occurs.
  827.    PRT_SetErrorFunc returns pointer to currently used ErrFunc.
  828.  
  829.  
  830.  
  831.    PRT_SetMargins
  832.    ===============
  833.  
  834. int PRT_SetMargins ( int left, int top );
  835.  
  836.    Specifies (in 1/1000 inch) the left and top margins that should be
  837. left free during printing. Note that in most cases margins left will
  838. be only some approximation of the specified values and may considerably
  839. differ from them.
  840.    Returns 0 on success, nonzero on failure.
  841.  
  842.  
  843.    PRT_SetOpenFunc
  844.    =====================
  845.  
  846.    typedef int ( FAR_PROC * PRT_OpenFuncP)( void );
  847. PRT_OpenFuncP PRT_SetOpenFunc ( int far f(void) );
  848.  
  849.    Defines function (passed as an argument f) which will be called to open
  850. file handle for printing out the picture. The f function takes no arguments
  851. and should return opened file handle. Returning nonpositive value will be
  852. treated as an error.
  853.    If NULL is passed as an argument f then the old open function used so far
  854. will not be changed.
  855.    PRT_SetOpenFunc returns pointer to previously used open function.
  856.  
  857.    See also PRT_SetCloseFunc, PRT_SetWriteFunc, PRT_SetErrorFunc.
  858.  
  859.  
  860.  
  861.    PRT_SetOutName
  862.    ==================
  863.  
  864. int PRT_SetOutName ( char FAR * DeviceName );
  865.  
  866.    Specifies where the graphic output should be sent. DeviceName
  867. can be any valid DOS device name (such as PRN,LPT1,LPT2,COM1, etc.)
  868. or file name (with or without the path). It is used in pascal assign
  869. procedure or C open function. Note that string pointed to by DeviceName
  870. is not copied but only reference is remembered. So DeviceName should
  871. not point to local dynamic area but to STATIC one rather.
  872.    Returns 0 on success, nonzero on failure.
  873.  
  874.  
  875.  
  876.  
  877.    PRT_SetViewSize
  878.    ===============
  879.  
  880. int FAR_PROC pascal PRT_SetViewSize( int x1, int y1, int x2, int y2 );
  881.  
  882. Parameters
  883.    x1,y1,x2,y2 - specifies rectangular piece of picture which will be
  884.                  build by the BitImage BGI driver.
  885. See also PRT_initgraph.
  886.  
  887.  
  888.    PRT_SetWriteFunc
  889.    =====================
  890.  
  891.    typedef int ( FAR_PROC * PRT_WriteFuncP)
  892.                       ( int handle, const void FAR_PTR * b, unsigned len );
  893. PRT_WriteFuncP FAR_PROC pascal PRT_SetWriteFunc
  894.                                ( int far f(int handle,void FAR_PTR* buf,
  895.                                  unsigned len) );
  896.  
  897.    Defines function (passed as an argument f) which will be called to print
  898. out len bytes pointed to by buf pointer.
  899.    Parameters of f function
  900.       handle  : an integer number returned by an open function set by
  901.                 PRT_SetOpenFunc. My default open function simply returns
  902.                 file handle.
  903.       buf     : Pointer to data bytes which must be printed out.
  904.       len     : Number of bytes to print.
  905. If f function returns nonzero value it will be treated as an I/O error.
  906.    If NULL is passed as an argument f then the old write function used so far
  907. will not be changed.
  908.    PRT_SetWriteFunc returns pointer to previously used write function.
  909.  
  910.    See also PRT_SetOpenFunc, PRT_SetCloseFunc, PRT_SetErrorFunc.
  911.  
  912.  
  913.  
  914.    PRT_Unregisterfarbgidriver
  915.    ========================
  916.  
  917. int FAR_PROC pascal PRT_Unregisterfarbgidriver ( void far pascal 
  918. (*driver)(void) );
  919.  
  920.    Used to unregister driver installed with PRT_registerfarbgidriver function.
  921. You MUST use it before erasing registered driver from memory.
  922.  
  923.  
  924.  
  925.    setfillpattern16
  926.    =================
  927.  
  928. void setfillpattern16 ( char FAR * upattern, int color );
  929.  
  930.    If standard 8x8 fill patterns are not satisfied for you use this
  931. function to define 16x16 patterns. Note that calling this function take
  932. effect only when BITIMAGE BGI is active, for all other BGI drivers it will
  933. be ignored. So the best approach is probably calling standard setfillpattern
  934. function and then setfillpattern16. In that case ignoring setfillpattern16
  935. will cause that the pattern set by standard setfillpattern function will be
  936. still in effect.
  937.  
  938.  
  939.    PRT_HaltPrinting
  940.    ================
  941.  
  942. Global variable. Is set to zero when PRT_PrintBGI starts. You may set it
  943. to nonzero value to force almost immediate return from PRT_PrintBGI function
  944. (without ending printing). This variable is tested after each line printed.
  945. Note however that if PRT_PrintBGI called your Draw function then it will wait
  946. for the Draw function to end before testing PRT_HaltPrinting.
  947.  
  948.  
  949.  
  950. ========================================================================
  951.          GRAPHIC   FUNCTIONS
  952. ========================================================================
  953.  
  954.    This sect on will describe all graphics functions that can be found
  955. in Borland Graph.TPU unit for TP or GRAPHICS.LIB for B/TC(++). Note
  956. that detailed description of each function can be found in appropriate
  957. Borland
  958. documentation. Here are only given some differences from their use in
  959. PRINTBGI package and standard Borland BGI drivers.
  960.  
  961.  
  962.  
  963. void far arc(int x, int y, int stangle, int endangle, int radius);
  964.    No comments.
  965.  
  966. void far  bar(int left, int top, int right, int bottom);
  967.    No comments.
  968.  
  969. void far  bar3d(int left, int top, int right, int bottom,
  970.                 int depth, int topflag);
  971.    No comments.
  972.  
  973. void far  circle(int x, int y, int radius);
  974.    No comments.
  975.  
  976. void far  cleardevice(void);
  977.    Does not enforce printing. Buffer is cleared and if mot printed
  978. earlier its content is lost forever.
  979.  
  980. void far  clearviewport(void);
  981.    No comments.
  982.  
  983. void far  closegraph(void);
  984.    You rather shouldn't use it with BitImage BGI driver. Use PRT_closegraph
  985. instead.
  986.  
  987. void far  detectgraph(int far *graphdriver,int far *graphmode);
  988.    It will return detect values for screen not for external devices.
  989.  
  990. void far  drawpoly(int numpoints, int far *polypoints);
  991.    No comments.
  992.  
  993. void far  ellipse(int x, int y, int stangle, int endangle,
  994.           int xradius, int yradius);
  995.    No comments.
  996.  
  997. void far  fillellipse( int x, int y, int xradius, int yradius );
  998.    No comments.
  999.  
  1000. void far  fillpoly(int numpoints, int far *polypoints);
  1001.    No comments.
  1002.  
  1003. void far  floodfill(int x, int y, int border);
  1004.    Not implemented in current release. It'll be implemented in future
  1005. releases but remember that may produce some inaccurate results if
  1006. there is less memory than needed to build whole bit map for the
  1007. picture. Compare with PRT_PrintBGI description. Note also that it
  1008. cannot be implemented for some kind of output devices.
  1009.  
  1010. void far  getarccoords(struct arccoordstype far *arccoords);
  1011.    No comments.
  1012.  
  1013. void far  getaspectratio(int far *xasp, int far *yasp);
  1014.    No comments.
  1015.  
  1016. int  far  getbkcolor(void);
  1017.    No comments.
  1018.  
  1019. int  far  getcolor(void);
  1020.    No comments.
  1021.  
  1022. struct palettetype far * far  getdefaultpalette( void );
  1023.    Not implemented.
  1024.  
  1025. char * far  getdrivername( void );
  1026.    Returns BGI driver name. Since the package uses always the
  1027. same BGI driver (called BITIMAGE BGI driver) it will always return
  1028. the word BITIMAGE. To obtain names of printer drivers supported call
  1029. PRT_DriverName function described in earlier section.
  1030.  
  1031. void far  getfillpattern(char far *pattern);
  1032.    See also getfillpattern16 and PRT_RescaleFillPattern.
  1033.  
  1034. void far  getfillsettings(struct fillsettingstype far *fillinfo);
  1035.    No comments.
  1036.  
  1037. int  far  getgraphmode(void);
  1038.    No comments.
  1039.  
  1040. void far  getimage(int left, int top, int right, int bottom,
  1041.             void far *bitmap);
  1042.    May not work if there is not enough memory for the entire picture.
  1043.  
  1044. void far  getlinesettings(struct linesettingstype far *lineinfo);
  1045.    No comments.
  1046.  
  1047. int  far  getmaxcolor(void);
  1048.    No comments.
  1049.  
  1050. int  far  getmaxmode(void);
  1051.    You should use rather PRT_MaxMode instead. Currently it always
  1052. returns zero since BitImage BGI driver being used supports one mode
  1053. only. Parameters which configure the driver for your needs can be set
  1054. using PRT_SetDriver function.
  1055.  
  1056.  
  1057. int  far  getmaxx(void);
  1058.    You should use it to rescale output according to screen sizes.
  1059.  
  1060. int  far  getmaxy(void);
  1061.    You should use it to rescale output according to screen sizes.
  1062.  
  1063. char * far  getmodename( int mode_number );
  1064.    No comments.
  1065.  
  1066. void far  getmoderange(int graphdriver, int far *lomode,
  1067.          int far *himode);
  1068.    Shouldn't be used.
  1069.  
  1070. unsigned   far  getpixel(int x, int y);
  1071.    May not work if there is not enough memory for the entire picture.
  1072.  
  1073. void far  getpalette(struct palettetype far *palette);
  1074. int  far  getpalettesize( void );
  1075. void far  gettextsettings(struct textsettingstype far *texttypeinfo);
  1076.    No comments.
  1077.  
  1078. void far  getviewsettings(struct viewporttype far *viewport);
  1079.    No comments.
  1080.  
  1081. int  far  getx(void);
  1082.    No comments.
  1083.  
  1084. int  far  gety(void);
  1085.    No comments.
  1086.  
  1087. void far  graphdefaults(void);
  1088.    No comments.
  1089.  
  1090. char * far  grapherrormsg(int errorcode);
  1091.    You may use PRT_errormsg instead.
  1092.  
  1093. void far  _graphfreemem(void far *ptr, unsigned size);
  1094. void far * far  _graphgetmem(unsigned size);
  1095. int  far  graphresult(void);
  1096.    No comments.
  1097.  
  1098. unsigned   far  imagesize(int left, int top, int right, int bottom);
  1099.    No comments.
  1100.  
  1101. void far  initgraph(int  far *graphdriver,
  1102.             int  far *graphmode,
  1103.             char far *pathtodriver);
  1104.    Use PRT_initgraph instead.
  1105.  
  1106. int  far  installuserdriver( char far *name, int huge (*detect)(void) );
  1107.    You must use PRT_installuserdriver to install PRINTBGI drivers.
  1108.  
  1109. int  far  installuserfont( char far *name );
  1110.    No comments.
  1111.  
  1112. void far  line(int x1, int y1, int x2, int y2);
  1113.    No comments.
  1114.  
  1115. void far  linerel(int dx, int dy);
  1116.    No comments.
  1117.  
  1118. void far  lineto(int x, int y);
  1119.    No comments.
  1120.  
  1121. void far  moverel(int dx, int dy);
  1122.    No comments.
  1123.  
  1124. void far  moveto(int x, int y);
  1125.    No comments.
  1126.  
  1127. void far  outtext(char far *textstring);
  1128.    To print standard fonts of code 128 or higher you should use DOS
  1129. GrafTabl command before, otherwise printing is garbage. Note also
  1130. that fonts table for characters 127 or lower is taken from ROM BIOS.
  1131. If you have no such a table in standard place some problems may also
  1132. occur.
  1133.    See also settextstyle comments.
  1134.  
  1135. void far  outtextxy(int x, int y, char far *textstring);
  1136.    See outtext and settextstyle comments.
  1137.  
  1138. void far  pieslice(int x, int y, int stangle, int endangle,
  1139.             int radius);
  1140.    No comments.
  1141.  
  1142. void far  putimage(int left, int top, void far *bitmap, int op);
  1143.    No comments.
  1144.  
  1145. void far  putpixel(int x, int y, int color);
  1146.    No comments.
  1147.  
  1148. void far  rectangle(int left, int top, int right, int bottom);
  1149.    No comments.
  1150.  
  1151. int         registerbgidriver (void (*driver)(void));
  1152.    To register BitImage driver you should use PRT_registerfarbgidriver
  1153. instead.
  1154.  
  1155. int   far   registerfarbgidriver (void far *driver);
  1156.    To register BitImage driver you should use PRT_registerfarbgidriver
  1157. instead.
  1158.  
  1159. int  registerbgifont (void (*font)(void));
  1160.    No comments.
  1161.  
  1162. int      far  registerfarbgifont (void far *font);
  1163.    No comments.
  1164.  
  1165. void far  restorecrtmode(void);
  1166.    Shouldn't be used. Before using PrintBGI toolkit functions you must
  1167. close down any active video BGI driver. To do this use closegraph not
  1168. restorecrtmode function. On the other hand using restorecrtmode with
  1169. BitImage BGI driver has little sense.
  1170.  
  1171. void far  sector( int X, int Y, int StAngle, int EndAngle,
  1172.            int XRadius, int YRadius );
  1173.    No comments.
  1174.  
  1175. void far  setactivepage(int page);
  1176.    Not implemented.
  1177.  
  1178. void far  setallpalette(struct palettetype far *palette);
  1179.    Not implemented.
  1180.  
  1181. void far  setaspectratio( int xasp, int yasp );
  1182.    You may use it to change current aspect ratio but remember that
  1183. default values are correct.
  1184.  
  1185. void far  setbkcolor(int color);
  1186.    Not implemented in current release.
  1187.  
  1188. void far  setcolor(int color);
  1189.    No comments.
  1190.  
  1191. void far  setfillpattern(char far *upattern, int color);
  1192.    See setfillpattern16 and PRT_RescaleFillPattern in previous section.
  1193.  
  1194. void far  setfillstyle(int pattern, int color);
  1195.    See PRT_RescaleFillPattern in previous section.
  1196.  
  1197. unsigned   far  setgraphbufsize(unsigned bufsize);
  1198.    No comments.
  1199.  
  1200. void far  setgraphmode(int mode);
  1201.    Shouldn't be used.
  1202.  
  1203.  
  1204. void far  setlinestyle(int linestyle, unsigned upattern,
  1205.          int thickness);
  1206.    No comments.
  1207.  
  1208. void far  setpalette(int colornum, int color);
  1209.    Not implemented.
  1210.  
  1211. void far  setrgbpalette(int colornum,
  1212.           int red, int green, int blue);
  1213.    Not implemented.
  1214.  
  1215. void far  settextjustify(int horiz, int vert);
  1216.    No comments.
  1217.  
  1218. void far  settextstyle(int font, int direction, int charsize);
  1219.    May produce different results for standard fonts (DEFAULT_FONT)
  1220. and direction other than HORIZ_DIR or VERT_DIR. May also behave
  1221. slightly different when text expands beyond clip region. You may use
  1222. PRT_Resolution function to compute desired fonts size.
  1223.  
  1224. void far  setusercharsize(int multx, int divx,
  1225.             int multy, int divy);
  1226.    No comments.
  1227.  
  1228. void far  setviewport(int left, int top, int right, int bottom,
  1229.         int clip);
  1230.    No comments.
  1231.  
  1232. void far  setvisualpage(int page);
  1233.    Not implemented.
  1234.  
  1235. void far  setwritemode( int mode );
  1236.    In difference with Borland's BGI drivers write mode defined by
  1237. that procedure is valid for all subsequent write operations. Mode
  1238. argument may be one of the following: COPYPUT, XORPUR, ORPUT,
  1239. AND_PUT, NOT_PUT not just limited to fist two constants only (as is
  1240. in Borland's library).
  1241.  
  1242. int  far  textheight(char far *textstring);
  1243.    No comments.
  1244.  
  1245. int  far  textwidth(char far *textstring);
  1246.    No comments.
  1247.  
  1248.  
  1249.  
  1250.       THE FUTURE
  1251.       ==========
  1252.  
  1253.    If there is some interest in this package I will write 1.0 version
  1254. which will
  1255.    - support all dot matrix printers, postscript printers and some
  1256.      others as well as some plotters,
  1257.    - contain table (and function to use it) with names of all available
  1258.      printers and appropriate driver number used by the package (if users
  1259.      support me in doing it) ,
  1260.    - let you keep printers definitions in separate file or linked in with
  1261.      the main module,
  1262.    - work in all memory models (except tiny of course),
  1263.    - be tested on more printers,
  1264.    - contain some more improvements, I hope.
  1265. All registered users will obtain this 1.0 version completely free.
  1266.  
  1267.  
  1268. To contact the author write to
  1269.  
  1270.    Andrzej Resztak
  1271.    ul. K. Wallenroda 2c/18
  1272.    20-607 Lublin
  1273.    POLAND
  1274.  
  1275. or (preferably) to e-mail address:
  1276.    Resztak@PLUMCS11.bitnet
  1277.  
  1278.  
  1279.  
  1280.    /* end of PRINTBGI.DOC  */
  1281.  
  1282.